﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace ZYHand.Utility
{
    public class AppSettingHelper
    {
        private static IConfiguration configuration = null;
        //静态方法
        public static IConfiguration GetConfiguration()
        {
            if (configuration == null)
            {
                configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory())
                .Add(new JsonConfigurationSource { Path = "appsettings.json", ReloadOnChange = true })
                .Build();
            }
            return configuration;
        }
    }
}
